home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / bn_TD_bignet.ph < prev    next >
Encoding:
Text File  |  1994-04-25  |  7.3 KB  |  275 lines

  1. /*****************************************************************************
  2.   FILE           : bn_TD_bignet.ph
  3.   SHORTNAME      : bn_TD_bignet
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : 
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Guenter Mamier
  10.   DATE           : 09.02.93
  11.  
  12.   CHANGED BY     : 
  13.   IDENTIFICATION : @(#)bn_TD_bignet.ph    1.6 3/2/94
  14.   SCCS VERSION   : 1.6
  15.   LAST CHANGE    : 3/2/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20. #ifndef _BN_TD_BIGNET_DEFINED_
  21. #define  _BN_TD_BIGNET_DEFINED_
  22.  
  23.  
  24.  
  25. /* begin global definition section */
  26.  
  27. void bn_create_TD_Bignet (void);
  28.  
  29. /* end global definition section */
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. /* begin private definition section */
  37.  
  38. #define TD_BN_RIGHT  0
  39. #define TD_BN_BELOW  1
  40. #define TD_BN_LEFT   2
  41.  
  42. #define TD_BN_INPUT 0
  43. #define TD_BN_OUTPUT 1
  44. #define TD_BN_HIDDEN 2
  45.  
  46. #define TD_SOURCE_PLANE 1
  47. #define TD_SOURCE_CLUSTER 3
  48. #define TD_SOURCE_UNIT 5
  49.  
  50. #define TD_TARGET_PLANE 8
  51. #define TD_TARGET_CLUSTER 17
  52. #define TD_TARGET_UNIT 33
  53.  
  54. #define PLANE_TO_PLANE 9
  55. #define PLANE_TO_CLUSTER 26
  56. #define PLANE_TO_UNIT 42
  57. #define CLUSTER_TO_PLANE 12
  58. #define CLUSTER_TO_CLUSTER 29
  59. #define CLUSTER_TO_UNIT 45
  60. #define UNIT_TO_PLANE 14
  61. #define UNIT_TO_CLUSTER 31
  62. #define UNIT_TO_UNIT 47
  63.  
  64. #define td_bn_widget_output(string) ((strcmp("0",string)==0) ? ("") : (string))
  65.  
  66. static int TD_BN_ERROR=0;
  67.  
  68. typedef struct plane {
  69.   int width;
  70.   int height;
  71.   int pos;
  72.   int type;
  73.   int begin;
  74.   struct plane *next;
  75.   struct plane *before;
  76. } TD_PLANE;
  77.  
  78. static char *td_plane_pos[] = {"right","below","left"};
  79. static char *td_plane_type[] = {"input","output","hidden"};
  80.  
  81. static TD_PLANE *TD_PLANE_current_element = NULL;
  82. static TD_PLANE *TD_PLANE_first_element = NULL;
  83. static TD_PLANE *TD_PLANE_last_element = NULL;
  84.  
  85. static int   TD_PLANE_length = 0;
  86. static int   TD_PLANE_no = 0;
  87. static int   TD_PLANE_pos = TD_BN_RIGHT;
  88. static int   TD_PLANE_type = TD_BN_INPUT;
  89.  
  90. static int TD_PLANE_width,TD_PLANE_height;
  91.  
  92. typedef struct link {
  93.   struct {
  94.     int plane;
  95.     struct {
  96.       int x;
  97.       int y;
  98.       int width;
  99.       int height;
  100.     } CLUSTER;
  101.     struct {
  102.       int x;
  103.       int y;
  104.     } UNIT;
  105.     struct {
  106.       int delta_x;
  107.       int delta_y;
  108.     } MOVE;
  109.   } SOURCE;
  110.   struct {
  111.     int plane;
  112.     struct {
  113.       int x;
  114.       int y;
  115.       int width;
  116.       int height;
  117.     } CLUSTER;
  118.     struct {
  119.       int x;
  120.       int y;
  121.     } UNIT;
  122.     struct {
  123.       int delta_x;
  124.       int delta_y;
  125.     } MOVE;
  126.   } TARGET;
  127.   int type_of_connection;
  128.   int move;
  129.   struct link *before;
  130.   struct link *next;
  131. } TD_LINK;
  132.  
  133. static TD_LINK *TD_LINK_current_element = NULL;
  134. static TD_LINK *TD_LINK_first_element = NULL;
  135. static TD_LINK *TD_LINK_last_element = NULL;
  136.  
  137. static int TD_LINK_length=0;
  138.  
  139. static int TD_LINK_move,TD_LINK_type_of_connection;
  140.  
  141. static int TD_LINK_source_move_delta_x,TD_LINK_source_move_delta_y,
  142.            TD_LINK_target_move_delta_x,TD_LINK_target_move_delta_y;
  143.  
  144. static int TD_LINK_source_plane,TD_LINK_source_cluster_x,
  145.        TD_LINK_source_cluster_y,
  146.            TD_LINK_source_cluster_width,TD_LINK_source_cluster_height,
  147.            TD_LINK_source_unit_x,TD_LINK_source_unit_y;
  148.  
  149. static int TD_LINK_target_plane,TD_LINK_target_cluster_x,
  150.        TD_LINK_target_cluster_y,
  151.            TD_LINK_target_cluster_width,TD_LINK_target_cluster_height,
  152.            TD_LINK_target_unit_x,TD_LINK_target_unit_y;
  153.  
  154. #define bn_fontWidth 8
  155.  
  156. static int td_bignet_widget_open = 0;
  157.  
  158. static int td_bn_intWidth = 6 * bn_fontWidth;
  159.  
  160.  
  161. static Widget td_baseWidget;
  162.  
  163. static Widget z1s1,z1s2,z1s3,z2s1,z3s1,z4s1,z5s1,z6s1,z7s1,z2s2,z3s2,z3s3,
  164.               z4s2,z4s3,z5s2,z5s3,z6s2,z6s3,z7s2,z7s3,z8s2,z8s3,z9s1,z9s2,
  165.               z9s3,z9s4,z10s1,z11s1,z12s1,z13s1,z15s1,z16s1,z10s2,z10s3,z10s4,
  166.               z10s5,z13s2,z13s3,z13s4,z13s5,z15s2,z15s3,z15s4,z15s5,z16s2,
  167.               z16s3,z16s4;
  168.  
  169.  
  170. static int TD_NET=0;
  171.  
  172.  
  173.  
  174. /* bn_bignet */
  175. static void bn_createPlanePannel (Widget parent);
  176. static void bn_createLinkPannel (Widget parent);
  177. static void exit_PROC (void);
  178.  
  179. /* bn_create_net */
  180. static void create_net_PROC(void);
  181. static void calculate_first_snns_unit_no_of_plane(void);
  182. static int calculate_x_begin(int *new_x_begin,int *old_x_begin,int *x_max,
  183.                  int width,int pos);
  184. static int calculate_y_begin(int *absolute_y_max,int *relative_y_max,
  185.                  int *y_offset,int height,int pos);
  186. static void create_snns_unit(void);
  187. static void make_link(TD_PLANE *TD_LINK_source_plane,
  188.               int TD_LINK_source_cluster_x,
  189.               int TD_LINK_source_cluster_y,
  190.               int TD_LINK_source_cluster_width,
  191.               int TD_LINK_source_cluster_height,
  192.               TD_PLANE *TD_LINK_target_plane,
  193.               int TD_LINK_target_cluster_x,
  194.               int TD_LINK_target_cluster_y,
  195.               int TD_LINK_target_cluster_width,
  196.               int TD_LINK_target_cluster_height);
  197. static void make_move_link(TD_PLANE *TD_LINK_source_plane,
  198.                int TD_LINK_source_cluster_x,
  199.                int TD_LINK_source_cluster_y,
  200.                int TD_LINK_source_cluster_width,
  201.                int TD_LINK_source_cluster_height,
  202.                TD_PLANE * TD_LINK_target_plane,
  203.                int TD_LINK_target_cluster_x,
  204.                int TD_LINK_target_cluster_y,
  205.                int TD_LINK_target_cluster_width,
  206.                int TD_LINK_target_cluster_height,
  207.                int TD_LINK_source_move_delta_x,
  208.                int TD_LINK_source_move_delta_y,
  209.                int TD_LINK_target_move_delta_x,
  210.                int TD_LINK_target_move_delta_y);
  211. static int move_p(TD_PLANE *plane_no,int *y,int *x,int width,int height,
  212.           int x_pivot,int x_step,int y_step);
  213. static void bn_display_net(void);
  214.  
  215. /* bn_link */
  216.  
  217. static int read_link_elements(void);
  218. static void write_current_link(void);
  219. static void clear_current_link(void);
  220. static void write_current_link_to_editor(void);
  221. static void clear_edit_link(void);
  222. static void enter_link_PROC(void);
  223. static void overwrite_link_PROC(void);
  224. static void delete_link_PROC(void);
  225. static void forward_link_PROC(void);
  226. static void backward_link_PROC(void);
  227. static void end_link_PROC(void);
  228. static void beginning_link_PROC(void);
  229. static void current_link_to_editor_PROC(void);
  230. static int correct_link_input(void);
  231. static void enter_link(void);
  232. static void overwrite_link(void);
  233. static void delete_current_link(void);
  234. static void get_links_and_delete_them(int plane_no);
  235. static int forward_link(void);
  236. static int backward_link(void);
  237. static int beginning_link(void);
  238. static int end_link(void);
  239.  
  240. /* bn_plane */
  241.  
  242. static int read_plane_elements(void);
  243. static void write_current_plane(void);
  244. static void clear_current_plane(void);
  245. static void write_current_plane_to_editor(void);
  246. static void clear_edit_plane(void);
  247. static void cancel_net_PROC(void);
  248. static void enter_plane_PROC(void);
  249. static void insert_plane_PROC(void);
  250. static void overwrite_plane_PROC(void);
  251. static void delete_plane_PROC(void);
  252. static void forward_plane_PROC(void);
  253. static void backward_plane_PROC(void);
  254. static void end_plane_PROC(void);
  255. static void beginning_plane_PROC(void);
  256. static void pos_PROC(void);
  257. static void current_plane_to_editor_PROC(void);
  258. static void type_PROC(void);
  259. static void enter_plane(void);
  260. static void insert_plane(void);
  261. static void overwrite_plane(void);
  262. static void delete_current_plane(void);
  263. static int forward_plane(void);
  264. static int backward_plane(void);
  265. static int beginning_plane(void);
  266. static int end_plane(void);
  267. static TD_PLANE *get_plane(int plane_no);
  268.  
  269. /* end private definition section */
  270.  
  271. #endif 
  272. /* end of file */
  273. /* lines: 255 */
  274.  
  275.